package com.example.webgobang.model.domin;

import com.example.webgobang.common.Constants;
import lombok.Data;

import static com.example.webgobang.common.Constants.RESPONSE_FAIL;
import static com.example.webgobang.common.Constants.RESPONSE_SUCCESS;

@Data
public class ResponseFormat {
    private int code;
    private String message;
    private Object data;

    public ResponseFormat(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static ResponseFormat success(Object data) {
        return new ResponseFormat(RESPONSE_SUCCESS, "result success", data);
    }

    public static ResponseFormat fail(String message) {
        return new ResponseFormat(RESPONSE_FAIL, message, null);
    }

    public static ResponseFormat fail(String message, Object data) {
        return new ResponseFormat(RESPONSE_FAIL, message, data);
    }
}
